﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

/// <summary>
///PublicFunction 的摘要说明
/// </summary>
public static class PublicFunction
{

    public static String GetRequstQueryString(System.Web.HttpRequest request, String key)
    {
        if (request.QueryString[key] != null)
            return request.QueryString[key].ToString().Trim();
        else
            return "";
    }

    public static String GetRequstForm(System.Web.HttpRequest request, String key)
    {
        if (request.Form[key] != null)
            return request.Form[key].ToString().Trim();
        else
            return "";
    }


    public static void JsAlert(System.Web.HttpResponse response,String Atxt)
    {
        response.Write("<script language=\"javascript\">alert('" + Atxt + "');</script>");
    }

    public static String GetStrByObj(object obj)
    {
        if (obj != null)
            return obj.ToString();
        else
            return "";
    }

    public static decimal GetDecimalByString(String v)
    {
        try
        {
            if (String.IsNullOrEmpty(v))
                return 0;
            else
                return decimal.Parse(v);
        }
        catch (Exception e)
        {
            return 0;
        }
    }


}
